package cn.cs.service;

import cn.cs.mapper.ClientBigUserMapper;
import cn.cs.mapper.UserAddressMapper;
import cn.cs.pojo.ClientBigUser;
import cn.cs.pojo.ClientUser;
import cn.cs.pojo.UserAddress;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


@RestController
public class UserAddressService {

    @Resource
    private UserAddressMapper userAddressMapper;

    @RequestMapping(value = "/getUserAddressListById", method = RequestMethod.POST)
    public List<UserAddress> getUserAddressListById(@RequestBody Map<String, Object> param)throws Exception{
        return userAddressMapper.getUserAddressListById(param);
    }

    @RequestMapping(value = "/getUserAddressById", method = RequestMethod.POST)
    public List<UserAddress> getUserAddressById(@RequestParam("userId") String userId)throws Exception{
        return userAddressMapper.getUserAddressById(userId);
    }

    @RequestMapping(value = "/getUserAddressByOnceId", method = RequestMethod.POST)
    public UserAddress getUserAddressByOnceId(@RequestParam("id") String id)throws Exception{
        return userAddressMapper.getUserAddressByOnceId(id);
    }

    @RequestMapping(value = "/getUserAddressListByMap", method = RequestMethod.POST)
    public List<UserAddress> getUserAddressListByMap(@RequestBody Map<String, Object> param)throws Exception{
        return userAddressMapper.getUserAddressListByMap(param);
    }

    @RequestMapping(value = "/getUserAddressCountByMap", method = RequestMethod.POST)
    public Integer getUserAddressCountByMap(@RequestBody Map<String, Object> param)throws Exception{
        return userAddressMapper.getUserAddressCountByMap(param);
    }

    @RequestMapping(value = "/itriptxAddUserAddress", method = RequestMethod.POST)
    public Integer itriptxAddUserAddress(@RequestBody UserAddress userAddress)throws Exception{
        return userAddressMapper.insertUserAddress(userAddress);
    }

    @RequestMapping(value = "/itriptxModifyUserAddress", method = RequestMethod.POST)
    public Integer itriptxModifyUserAddress(@RequestBody UserAddress userAddress)throws Exception{
        return userAddressMapper.updateUserAddress(userAddress);
    }

    @RequestMapping(value = "/modifyUserAddressByUserId", method = RequestMethod.POST)
    public Integer modifyUserAddressByUserId(@RequestBody UserAddress userAddress)throws Exception{
        return userAddressMapper.updateUserAddressByUserId(userAddress);
    }

    @RequestMapping(value = "/itriptxDeleteUserAddressById", method = RequestMethod.POST)
    public void itriptxDeleteUserAddressById(@RequestParam("id") String id)throws Exception{
        userAddressMapper.deleteUserAddressById(id);
    }

    @RequestMapping(value = "/updateAddressTypeId", method = RequestMethod.POST)
    public void updateAddressTypeId(@RequestParam("id") String id)throws Exception{
        userAddressMapper.updateAddressTypeId(id);
    }



}
